package homework_java.RoomQ.xy_java.src.Test;

import java.util.Objects;

public class Student {

    String sname;
    int sno;
    String smajor;

    public Student(String sname, int sno, String smajor) {
        this.sname = sname;
        this.sno = sno;
        this.smajor = smajor;
    }

    @Override
    public String toString() {
        return "Student{" +
                "sname='" + sname + '\'' +
                ", sno=" + sno +
                ", smajor='" + smajor + '\'' +
                '}';
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return sno == student.sno && Objects.equals(sname, student.sname) && Objects.equals(smajor, student.smajor);
    }
    @Override
    public int hashCode() {
        return Objects.hash(sname, sno, smajor);
    }
}
